//激光道具
module py2Obj {


    export class laserProp extends basicProp {
        //玩家加分
        public pointList: egret.Point[] = [];
        public m_point: number;
        m_fb: fakeBullet;
        public constructor(world: any, gamePanle: any, romveSkins: any) {
            super(world, gamePanle, romveSkins);
            this.objkind = 404;
        }
        public init() {
            super.init();
        }
        public createMyRigidbody(): p2.Body {
            var world: P2World = this.m_world;
            var skin: MImage = this.createSkin("ball_png");
            //	var body: p2.Body = world.createBoxBodyShape(skin.width, skin.height, p2.Body.KINEMATIC);
            var body: p2.Body = world.createCircleBodyShape(skin.width >> 2, p2.Body.KINEMATIC);
            body.userData.skin = skin;
            body.userData.data = this;
            body.mass = 0;//质量设置为0，就可以按规定方向发射，等发生碰撞之后再给球质量
            //body.gravityScale=0;
            var shape = body.shapes[0];
            shape.collisionMask = 6;
            // trace(shape.collisionGroup,shape.collisionMask)
            return body;
        }
        public Destroy() {
            var goold = new Array();
			goold = PropManager.twoProp;
			if (goold.length > 0) {
				let length = goold.length
				for (let i = 0; i < length; i++) {
					let jinbi = goold[0];
					goold.splice(0, 1);
					this.m_propManger.removePorp1(jinbi);
				}
			}
			else {
			this.m_propManger.removePorp1(this);
			}

            //this.m_propManger.removePorp1(this);
        }

        public getCollision(otherBody: basicObj) {
            super.getCollision(otherBody);

            if (otherBody.objkind == 301 || otherBody.objkind == 103||otherBody.objkind == 102||otherBody.objkind==104||otherBody.objkind==105) {
                GameControl.GameControlSole.laserResult(this.m_body.position[0], this.m_body.position[1]);
                // this.m_gamePanle.addPoint(this.m_point);
                // this.m_fb = <fakeBullet>otherBody;
                // var bullet = this.m_fb.runEnd();
                this.Destroy();
                //return bullet;
            }
        }

    }
}